const {
	db,
	dbCmd,
	result_success,
	result_error,
	appletInfoCollection,
	collectionCollection
} = require('../../common/constants')
module.exports = async function(params = {}) {
	const token = this.getUniIdToken()
	if (!token) {
		return result_error('登录失效,请重新登录')
	}
	let payload = await this.uniID.checkToken(token)
	if (payload.code) {
		return payload
	}
	let collecitonOrder = await await db.collection('wmzmall-collection-order').where({
			collectionId: params.id,
			state: '已完成'
		})
		.skip(params.skip)
		.limit(params.limit)
		.orderBy('create_time', 'desc')
		.get()
	collecitonOrder = collecitonOrder.data
	console.log(collecitonOrder)
	return result_success(collecitonOrder)
}